#!/bin/bash

## find all files
CUR=`pwd`

ECHO="echo -e"

FIND="192.168.10.2"
TO="192.168.64.2"

lines=`find . -name "*.txt" | xargs grep $FIND`

files=`echo "$lines" | cut -d ':' -f 1`

$ECHO "$files"

for f in $files; do
    $ECHO "Change file $f ..."
    sed 's/192.168.10.2/192.168.64.2/g' -i $f
done

$ECHO "Done"

